public class PP12_9 {
        public static void main(String args[])
        {
            Scanner scan = new Scanner(System.in);
            Scanner xxx = new Scanner(System.in);
            System.out.println("输入该三角的层数");
            int x = scan.nextInt();//输入几层是几层
            int num[][] = new int[x][x];//这个数组有几层
            for(int m=0;m<x;m++)//主要是对数组进行赋值
            {
                for(int n=0;n<=m;n++)
                {
                    if(n==0||m==n)
                    {
                        num[m][n]=1;
                    }
                    else
                        num[m][n]=num[m-1][n-1]+num[m-1][n];
                }
            }
            for(int i=0;i<x;i++)
            {
                for(int l=i;l<x;l++)
                {
                    System.out.print(" ");
                }
                for(int j=x-i;j<=x;j++)
                {
                    System.out.print(num[i][x-j]+" ");
                }
                System.out.println();
            }
            System.out.println("输出单独第n行");
            int y = xxx.nextInt();
            for (int z = 0;z < y; z++){
            System.out.print(num[y - 1][z]);
            }
        }
    }

